<?php

namespace api\web\controller;

use api\web\model\NavModel;
use cmf\controller\RestBaseController;

class NavController extends RestBaseController
{
    public function getNavList()
    {
        $keyword = input('get.keyword','');
        $where = [];
        if ($keyword) {
            $where[] = ['id', 'like', '%' . $keyword . '%'];
        }

        //页码
        $page = input('page/d',1);
        //每页返回的条数
        $pageSize = input('page_size/d',10);
        $list = NavModel::where($where)
            ->order('list_order','desc')
            ->field('id,title,image,url,create_time,update_time')
            ->page($page,$pageSize)
            ->select();

        $this->success('导航菜单表', $list);
    }
}